<?PHP

require_once __DIR__.DIRECTORY_SEPARATOR.'functions.php';

$url = WXURL.'menu/create?access_token='.ACCESS_TOKEN;

$data = [
    'button' => [
        [
            'name' => '扫码发图',
            'sub_button' => [
                [
                    'type' => 'scancode_waitmsg',
                    'name' => '扫码带提示',
                    'key' => 'code_0'
                ],
                [
                    'type' => 'scancode_push',
                    'name' => '扫码推事件',
                    'key' => 'code_1',
                ],
                [
                    'type' => 'pic_sysphoto',
                    'name' => '系统拍照发图',
                    'key' => 'pic_0',
                ],
                [
                    'type' => 'pic_photo_or_album',
                    'name' => '拍照或相册发图',
                    'key' => 'pic_1',
                ],
                [
                    'type' => 'pic_weixin',
                    'name' => '微信相册发图',
                    'key' => 'pic_2',
                ]
            ]
        ],
        [
            'name' => '点击',
            'sub_button' => [
                [
                    'type' => 'click',
                    'name' => '今日歌曲',
                    'key' => 'click_0'
                ],
                [
                    'type' => 'click',
                    'name' => '赞一下',
                    'key' => 'click_1',
                ],
                [
                    'type' => 'view',
                    'name' => '百度',
                    'url' => 'http://www.baidu.com',
                ],

            ]
        ],
        [
            'name' => '其它',
            'sub_button' => [
                [
                    'type' => 'location_select',
                    'name' => '发送位置',
                    'key' => 'o_0'
                ],
                /*
                 * [
                 *     'type' => 'media_id',
                 *     'name' => '图片',
                 *     'media_id' => 'MEDIA_ID1'
                 * ],
                 * [
                 *     'type' => 'view_limited',
                 *     'name' => '图文信息',
                 *     'media_id' => 'MEDIA_ID2'
                 * ]
                 */
            ]
        ]
    ]
];

$data = json_encode($data, JSON_UNESCAPED_UNICODE);

echo $data, PHP_EOL;

$wx = json_decode(kyo_curl($url, $data, 'POST'));

print_r($wx);

